<template>
	<view class="content">
		<view class="area-box">
			<textarea maxlength="-1" @input="textareaBInput" :placeholder="form.checkStatus==1?'请输入审核通过意见(选填)':'请输入审核拒绝意见(必填)'"></textarea>
		</view>
		<div class="common-btn">
			<button class="cu-btn block bg-green margin-tb-sm lg" @click="submit">保存</button>
		</div>
	</view>
</template>

<script>
	import api from '@/api/api.js';
	export default {
		data() {
			return {
				form:{
					contractId:undefined,
					checkStatus:undefined,
					auditNote:undefined
				}
			}
		},
		onLoad(options) {
			this.form.contractId = options.contractId;
			this.form.checkStatus = options.checkStatus
			if(this.form.checkStatus == 1) {
				uni.setNavigationBarTitle({
					title:'通过审核'
				})
			} else if(this.form.checkStatus == 2) {
				uni.setNavigationBarTitle({
					title:'拒绝审核'
				})
			}
			// 修改顶部导航背景色
			uni.setNavigationBarColor({
				frontColor: '#ffffff',
				backgroundColor: '#39b54a',
				animation: {
					duration: 400,
					timingFunc: 'easeIn'
				}
			})
		},
		methods: {
			textareaBInput(e) {
				this.auditNote = e.detail.value
			},
			submit(){
				api.auditContract(this.form).then(
					res => {
						if(res.code==200){
							uni.showToast({
								title: '审核成功',
								duration: 2000
							});
							setTimeout(function() {
								uni.navigateBack({
								  success: () => {
								  }
								})
							}, 500);
						}
						else{
							uni.showToast({
								title: res.msg,
								icon: 'none',
							});
						}
						
					},
					rej => {}
				);
			},
		}
	}
</script>

<style lang="scss">
	page{
		height: 100%;
	}
	.content{
		height: 100%;
		display: flex;
		flex-direction: column;
		justify-content: space-between;
		.area-box{
			margin-top: 20upx;
			padding: 20upx 24upx;
			background: #fff;
			textarea{
				width: 100%;
				height: 200upx;
				border: 1px solid #f7f7f7;
				border-radius: 8upx;
				padding: 20upx;
			}
		}
		.btn-box{
			padding: 20upx 24upx;
			.submit-btn{
				height: 80upx;
				line-height: 80upx;
				text-align: center;
				font-size: 28upx;
				color: #fff;
				border-radius: 8upx;
				background: #2362FB;
			}
		}
	}
</style>
